import { Photo } from 'src/common/entities/photo.entity';
import {
  Column,
  CreateDateColumn,
  Entity,
  OneToMany,
  PrimaryGeneratedColumn,
} from 'typeorm';

@Entity({ name: 'room' })
export class Room {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @Column({ type: 'text' })
  info: string;

  @Column()
  price: number;

  @Column()
  capacity: number;

  @Column()
  bedroom: number;

  @Column()
  toilet: number;

  @Column()
  hot: number;

  @Column()
  air: number;

  @Column()
  washer: number;

  @Column()
  wifi: number;

  @Column()
  pojector: number;

  @Column({ name: 'sold_out', default: 0 })
  soldOut: number;

  @OneToMany((type) => Photo, (photo) => photo.room, { cascade: true })
  photos: Photo[];

  @CreateDateColumn({ name: 'update_time' })
  updateTime: Date;
}
